package com.alibaba.japan.club.runtime.springmvc.util;

import javax.servlet.http.HttpServletRequest;

import org.springframework.web.servlet.HandlerMapping;

import com.alibaba.japan.club.runtime.springmvc.module.ModuleHelper;

/**
 * 该类主要是用来获得URL中匹配到的参数<br>
 * 如:<br>
 * "/product/12345.htm" --> "123456"
 * 
 * @author:shaochuan.wangsc
 * @date:2009-3-24
 * 
 */
public class MappingAttributeUtil {

	public static String getMappingAttribute(HttpServletRequest request) {
		String mappingAttribute = (String) request.getAttribute(HandlerMapping.PATH_WITHIN_HANDLER_MAPPING_ATTRIBUTE);
		return ModuleHelper.URL_EXTENSION_PATTERN.matcher(mappingAttribute).replaceAll("");
	}
}
